
import baseRequest from "@/utils/request";

/**
 * 重写request
 * @param config
 * @returns {Promise | Promise<unknown>}
 */
const request = function (config) {
  config.baseURL = process.env.VUE_APP_BASE_API + '/combination'
  return baseRequest(config)
}

/**
 * 获取组装工单
 * @param params
 * @returns {Promise|Promise<*>}
 */
export function getCombinationList(params = {}){
  return request({
    url: '/getCombinationList',
    method: 'get',
    params,
  })
}

/**
 * 获取组装工单详情
 * @param id
 * @returns {Promise|Promise<*>}
 */
export function getCombinationInfo(id){
  return request({
    url: `/getCombinationInfo/${id}`,
  })
}

/**
 * 完成组装
 * @param data
 * @returns {Promise|Promise<*>}
 */
export function finishCombination(data){
  return request({
    url: '/finishCombination',
    method: 'put',
    data,
    handleError: true,
  })
}
